{extend name="public:base" /}
{block name="theme"}业务管理{/block}
{block name="small_theme"}编辑订单{/block}
{block name="breadcrumb"}
<li><a href="{:url('olist')}">业务列表</a></li>
<li class="active">业务首页</li>
{/block}
{block name="content"}
<style>
    input.error { border: 1px solid red; }
    label.error {
        font-weight: bold;
        color: #EA5200;
    }
</style>
<link rel="stylesheet" href="__CSS__/style.css">
<link rel="stylesheet" href="__CSS__/addcomon.css">
<div class="row" style="padding:15px;">
    <div class="col-xs-12">
        <div class="box">
            <div class="box-header" data-original-title="" style="height: 40px;">
                <h2>编辑顾客订单&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ID:{$info.id}</h2>
            </div>
            <form  id="commentForm" method="post" action="{:url('edit')}" >
                <div class="add-box">
                    <div class="box-left">
                        <input type="hidden" name="id" value="{$info.id}" id="id">
                        <label>顾客信息：</label>
                        <div class="form-group add-form-group">
                            <label>顾客姓名</label>
                            <input type="text" name="name" value="{$info.name}" {neq name="info.qd_depar" value="4"}disabled{/neq}>
                        </div>
                        <div class="form-group add-form-group">
                            <label>妈妈电话</label>
                            <input type="text" name="maphone" value="{$info.maphone}" id="maphone" {neq name="info.qd_depar" value="4"}disabled{/neq} >
                        </div>
                        <div class="form-group add-form-group">
                            <label>家人电话</label>
                            <input type="text" name="otherphone" {neq name='info.otherphone' value='0'}value="{$info.otherphone}"{/neq} id="otherphone" {neq name="info.qd_depar" value="4"}disabled{/neq} >
                        </div>
                        <div class="form-group add-form-group">
                            <label>微信</label>
                            <input type="text" name="weixin" {neq name='info.weixin' value='0'}value="{$info.weixin}"{/neq} id="weixin" {neq name="info.qd_depar" value="4"}disabled{/neq} >
                        </div>
                        <div class="form-group add-form-group">
                            <label>QQ</label>
                            <input type="text" name="qq" {neq name='info.qq' value='0'}value="{$info.qq}"{/neq} id="qq" {neq name="info.qd_depar" value="4"}disabled{/neq} >
                        </div>
                        <div class="form-group add-form-group">
                            <label>预产期</label>
                            <input type="text" name="yctime"  onclick="laydate({min:laydate.now()})" {neq name="info.yctime" value="1970-01-01"}value="{$info.yctime}"{/neq} {neq name="info.qd_depar" value="4"}disabled {/neq} >
                        </div>
                        <div class="form-group add-form-group">
                            <label>业务分类</label>
                            <select class="form-control" name="fenlei" {neq name="info.qd_depar" value="4"}disabled{/neq} >
                                <!--<option value="">请选择分类</option>-->
                                {volist name='fenlei' id='data'}
                                <option value="{$data.id}" {eq name="info['fenlei']" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="form-group add-form-group">
                            <label>业务状态</label>
                            <select class="form-control" name="ywstate" >
                                {volist name='state' id='data'}
                                <option value="{$data.id}" {$data.status}{eq name="info['ywstate']" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>

                    <div class="box-right">
                        <label>渠道信息：</label>
                        <div class="form-group add-form-group">
                            <label>渠道</label>
                            <select class="form-control" name="qudao" disabled>
                                <option value="">请选择渠道</option>
                                {volist name='qudao' id='data'}
                                <option value="{$data.id}" {eq name="info['qudao']" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="form-group add-form-group">
                            <label>区域</label>
                            <select class="form-control" name="area" {neq name="info.qd_depar" value="4"}disabled{/neq} id="area">
                                <option value="">请选择区域</option>
                                {volist name='area' id='data'}
                                <option value="{$data.id}" {eq name="info['area']" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="form-group add-form-group">
                            <label>收集医院</label>
                            <select class="form-control" name="yiyuan" {neq name="info.qd_depar" value="4"}disabled{/neq} id="yiyuan">
                                <option value="">请选择医院</option>
                                {volist name='yiyuan' id='data'}
                                <option value="{$data.id}" {eq name="info['yiyuan']" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="form-group add-form-group">
                            <label>医院渠道</label>
                            <select class="form-control" name="menzhen" id="menzhen" {neq name="info.qd_depar" value="4"}disabled{/neq} >
                                <option value="">请选择门诊</option>
                                {volist name='menzhen' id='data'}
                                <option value="{$data.id}" {eq name="info['menzhen']" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="add-form-group">
                            <label>渠道备注</label>
                            <textarea type="text" rows="5" name="qdbz" disabled >{neq name='info.qdbz' value='0'}{$info.qdbz}{/neq}</textarea>
                        </div>
                    </div>

                    <div class="box-left">
                        <label>邀约和摄影场信息：</label>
                        <div class="form-group add-form-group">
                            <label>邀约客服</label>
                            <select class="form-control" name="yykf" disabled>
                                <option value="">请选择邀约客服</option>
                                {volist name='yykf' id='data'}
                                <option value="{$data.id}" {eq name="info['yykf']" value="$data.id"}selected="selected"{/eq} >{$data.username}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="form-group add-form-group">
                            <label>预约场馆</label>
                            <select class="form-control" name="yycg" disabled>
                                <option value="">请选择预约场馆</option>
                                {volist name='yycg' id='data'}
                                <option value="{$data.id}" {eq name="info['yycg']" value="$data.id"}selected="selected"{/eq} >{$data.title}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="form-group add-form-group">
                            <label>预约拍摄时间</label>
                            <input type="text" name="yypstime" class="form-control" onclick="laydate()" {neq name="info.yypstime" value="1970-01-01 8:00"}value="{$info.yypstime}"{/neq} disabled >
                        </div>
                        <div class="form-group add-form-group">
                            <label>追踪日期</label>
                            <input type="text" name="zztime" class="form-control" onclick="laydate()" {neq name="info.zztime" value="1970-01-01"}value="{$info.zztime}"{/neq} disabled >
                        </div>
                        <div class="add-form-group">
                            <label>邀约备注</label>
                            <textarea type="text" rows="5" name="yybz" disabled >{neq name='info.yybz' value='0'}{$info.yybz}{/neq}</textarea>
                        </div>
                        <div class="add-form-group">
                            <label>拍摄备注</label>
                            <textarea type="text" rows="5" name="psbz" disabled>{neq name='info.psbz' value='0'}{$info.psbz}{/neq}</textarea>
                        </div>
                    </div>

                    <div class="box-right">
                        <label>活动信息：</label>
                        <div class="form-group add-form-group">
                            <label>活动门店</label>
                            <input type="hidden" name="hsdzid" value="{$info.hsdzid}">
                            <select class="form-control" name="hsdzid" disabled>
                                <option value="">请选择活动门店</option>
                                {volist name='hdmd' id='data'}
                                <option value="{$data.id}"  {eq name="info['hsdzid']" value="$data.id"}selected="selected"{/eq} >{$data.title}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="form-group add-form-group">
                            <label>会所专员</label>
                            <select class="form-control" name="hszyid">
                                <option value="">请选择会所专员</option>
                                {volist name='hszy' id='data'}
                                <option value="{$data.id}" {eq name="info['hszyid']" value="$data.id"}selected="selected"{/eq} >{$data.username}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="form-group add-form-group">
                            <label>活动状态</label>
                            <select class="form-control" name="hdstate" id="hdstate">
                                <option value="">请选择活动状态</option>
                                {volist name='hsstate' id='data'}
                                <option value="{$data.id}"  {eq name="info['hdstate']" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="form-group add-form-group">
                            <label>预约上课时间</label>
                            <input type="text" name="yysktime" id="yysktime" onclick="laydate({min: laydate.now(),istime: true,format: 'YYYY-MM-DD hh:mm'})" {neq name="info.yysktime" value="1970-01-01 8:00"}value="{$info.yysktime}"{/neq} >
                        </div>
                        <div class="form-group add-form-group">
                            <label>课程</label>
                            <select class="form-control" name="kcid" id="kcid">
                                <option value="">请选择课程</option>
                                {volist name='kecheng' id='data'}
                                <option value="{$data.id}" {eq name="info['kcid']" value="$data.id"}selected="selected"{/eq} >{$data.name}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="add-form-group">
                            <label>会所备注</label>
                            <textarea type="text" rows="5" name="hsbz">{neq name='info.hsbz' value='0'}{$info.hsbz}{/neq}</textarea>
                        </div>
                        <label>自动提交开关：</label>
                        <div class="form-group add-form-group">
                            <label>微信开关:</label>
                            <label style="width:20px;">开</label><input type="radio" name="wxkg"  value="1" {neq name="info.ywstate" value="7"}checked{/neq} style="width:25px;height:25px;"  >
                            <label style="width:70px;">关</label><input type="radio" name="wxkg"  value="0" {eq name="info.ywstate" value="7"}checked{/eq} style="width:25px;height:25px;"  >
                        </div>
                        <div class="form-group add-form-group">
                            <label>短信开关:</label>
                            <label style="width:20px;">开</label><input type="radio" name="msgkg"  value="1" {lt name="info.yyhdnum" value="1"}checked{/lt} style="width:25px;height:25px;">
                            <label style="width:70px;">关</label><input type="radio" name="msgkg"  value="0" {egt name="info.yyhdnum" value="1"}checked{/egt} style="width:25px;height:25px;">
                        </div>
                    </div>

                    <div class="btn-box">
                        {:token()}
                        <button type="submit" class="btn btn-color-o" id="submit">提交</button>
                        <button type="button" class="btn btn-color-g" onclick="jumpurl()">返回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}

{block name="js"}
<script type="text/javascript" src="__JS__/moment.js"></script>
<script type="text/javascript" src="__STATIC__/validate/jquery.validate.min.js"></script>
<script type="text/javascript" src="__STATIC__/validate/jquery.metadata.js"></script>
<script type="text/javascript" src="__STATIC__/laydate/laydate.js"></script>
<script type="text/javascript" src="__JS__/yewu.js"></script>
<script type="text/javascript" src="__JS__/chachong.js"></script>

<script type="text/javascript">
        function jumpurl() {
            var p = {$p};
            if( p == 0 ){
                window.location.href = "{:url('olist',['editid'=>$info.id])}";
            }else{
                window.location.href = "{:url('olist',['editid'=>$info.id,'p'=>$p])}";
            }
        }
</script>

<script type="text/javascript">
    $().ready(function() {
        $('#hdstate').change(function () {
            if($('#hdstate').val() == 76){
                $("#yysktime").attr('required','required');
                $("#kcid").attr('required','required');
            }else{
                $("#yysktime").removeAttr('required');
                $("#kcid").removeAttr('required');
            }
        });

        // 在键盘按下并释放及提交后验证提交表单
        $("#commentForm").validate({
            messages: {
                yysktime:   "选择上课时间",
                kcid:        "请选择课程！"
            },
            submitHandler: function(form)
            {
                $.ajax({
                    type: "POST",
                    url:  "{:url('edit')}",
                    data: $(form).serialize(),
                    beforeSend:function(){
                        $('#submit').attr("disabled","false"); //禁止点击
                        layer.msg('提交中', {icon: 16,shade: 0.01,time:5000});
                    },
                    success: function(msg){
//                        console.log(msg);

                        if(msg.status==1){
                            $('#submit').attr("disabled","false"); //禁止点击
                            layer.msg(msg.info, {icon: 1});
                            setTimeout(function(){
                                location.href=msg.url;
                            },3000); //延迟演示
                        }else{
                            layer.msg(msg.info, {icon: 5});
                            $('#submit').removeAttr("disabled"); //禁止点击
                        }
                    }
                });
            }

        });
        return false;
    });
    highlight_subnav("{:url('olist')}");
</script>
{/block}